import request from '@/utils/request'
import store from '@/store'

export function GetImgSortList(locationType) {
  return request({
    url: '/User/GetImgSortList',
    method: 'post',
    data: {
      ...store.getters.authenticate,
      locationType: locationType
    }
  })
}

// /api/User/SearchCompanyName?searchKey=出版社
export function SearchCompanyName(keyword) {
  return request({
    url: '/User/SearchCompanyName',
    method: 'get',
    params: {
      searchKey: keyword
    }
  })
}

// /api/User/SortImg
export function SortImg(form) {
  return request({
    url: '/User/SortImg',
    method: 'post',
    data: {
      ...store.getters.authenticate,
      locationType: form.location_type,
      pid: form.pid,
      sort_id: form.sort_id,
      companyname: form.companyname
    }
  })
}

// /api/User/GetMaxSortId?Account=admin
export function GetMaxSortId(locationType) {
  return request({
    url: '/User/GetMaxSortId',
    method: 'get',
    params: {
      ...store.getters.authenticate,
      locationType: locationType
    }
  })
}

// /api/User/DeleteImg
export function DeleteImg(locationType, pid) {
  return request({
    url: '/User/DeleteImg',
    method: 'post',
    data: {
      ...store.getters.authenticate,
      locationType: locationType,
      pid: pid
    }
  })
}

// /api/User/UpdateYuanquZican
export function UpdateYuanquZican(form) {
  return request({
    url: '/User/UpdateYuanquZican',
    method: 'post',
    data: {
      ...store.getters.authenticate,
      ...form
    }
  })
}

// /api/User/AddYuanquNews
export function AddYuanquNews(form) {
  return request({
    url: '/User/AddYuanquNews?account='+store.getters.authenticate.account,
    method: 'post',
    data: {
      // ...store.getters.authenticate,
      ...form
    }
  })
}
